export const getOption = (self) => {
  return {
    height: 'calc(100vh - 480px)',
    calcHeight: 30,
    selectionList: [],
    tip: false,
    searchShow: true,
    searchMenuSpan: 5,
    border: true,
    index: true,
    viewBtn: false,
    editBtn: false,
    delBtn: false,
    addBtn: false,
    indexLabel: '序号',
    columnBtn: false,
    selection: true,
    column: [
      {
        label: '检验单号',
        prop: 'documentNo',
        searchValue: '',
        searchOrder: 7,
        type: 'search',
        search: true,
        appendClick: () => {
          self.openDocumentNoModel();
        }
      },
      {
        label: '发货单号',
        prop: 'sourceNo',
        type: 'search',
        searchOrder: 5,
        search: true,
        appendClick: () => {
          self.openWorkOrderCommonModal('pageWorkOrderModal');
        }
      },
      {
        label: '客户名称',
        prop: 'partnerName',
        search: true,
        type: 'search',
        searchOrder: 3,
        appendClick: () => {
          self.openPartnerModal();
        }
      },
      {
        label: '物料编码',
        prop: 'partNo',
        type: 'search',
        search: true,
        searchOrder: 1,
        appendClick: () => {
          self.openPartModal();
        }
      },
      {
        label: '物料名称',
        prop: 'partName'
      },
      {
        label: '产品型号',
        prop: 'partModel',
        search: true,
        searchOrder: 2
      },
      {
        label: '需求数量',
        prop: 'sheetDetailQuantity'
      },
      {
        label: '是否加急',
        prop: 'isUrgent',
        search: true,
        searchOrder: 4,
        type: 'select',
        dicData: [
          { label: '是', value: true },
          { label: '否', value: false }
        ]
      },
      {
        label: '检验状态',
        prop: 'status',
        type: 'select',
        dicData: [
          { label: '未检验', value: 1 },
          { label: '已检验', value: 2 },
          { label: '已撤销', value: 3 },
          { label: '草稿', value: 4 },
          { label: '超期关闭', value: 5 }
        ]
      },
      {
        label: '报检人',
        prop: 'createUserName'
      },
      {
        label: '报检时间',
        prop: 'createTime'
      }
    ]
  };
};
export const revokeOption = {
  submitBtn: false,
  emptyBtn: false,
  labelWidth: 150,
  group: [
    {
      label: '撤销原因',
      prop: 'revoke',
      arrow: false,
      icon: 'el-icon-vertical-bar',
      column: [
        {
          label: '撤销原因',
          prop: 'revocation',
          type: 'textarea',
          span: 24,
          maxRows: 3,
          minRows: 3,
          rules: [
            {
              required: true,
              message: '请选择撤销原因',
              trigger: 'blur'
            }
          ]
        }
      ]
    },
    {
      label: '基本信息',
      prop: 'basicInfo',
      arrow: false,
      icon: 'el-icon-vertical-bar',
      column: [
        {
          label: '检验单号',
          prop: 'documentNo',
          disabled: true
        },
        // {
        //   label: '检验分类',
        //   prop: 'sourceTypeName',
        //   disabled: true,
        //   value: '出货前'
        // },
        // {
        //   label: '产线',
        //   prop: 'lineName',
        //   disabled: true
        // },
        {
          label: '物料编码',
          prop: 'partNo',
          disabled: true
        },
        {
          label: '物料名称',
          prop: 'partName',
          disabled: true
        },
        {
          label: '是否加急',
          prop: 'isUrgent',
          type: 'switch',
          value: false,
          dicData: [
            {
              label: '否',
              value: false
            },
            {
              label: '是',
              value: true
            }
          ],
          disabled: true
        },
        {
          label: '客户名称',
          prop: 'partnerName',
          disabled: true
        },
        {
          label: '发货单号',
          prop: 'sourceNo',
          disabled: true
        }
      ]
    }
  ]
};

export const getAddOption = (self) => {
  return {
    submitBtn: false,
    emptyBtn: false,
    labelWidth: 150,
    column: [
      {
        label: '发货单号',
        prop: 'sourceNo',
        type: 'search',
        rules: [
          {
            required: true,
            message: '请选择发货单号',
            trigger: 'blur'
          }
        ],
        disabled: true,
        appendClick: () => {
          self.openWorkOrderCommonModal('addWorkOrderModal');
        }
      },
      {
        label: '物料编码',
        prop: 'partMasterId',
        filterable: true,
        type: 'select',
        dicData: [],
        rules: [{ required: true, message: '请选择物料编码', trigger: 'change' }],
        change: ({ value }) => {
          let material = self._find(self.materialList, { partMasterId: value });
          self.addForm.partName = material.partMasterName;
          self.addForm.partNo = material.partNo;
          self.addForm.partnerName = material.partnerName;
          self.addForm.quantity = material.quantity;
          self.addForm.partModel = material.partMasterModel;
          self.addForm.partnerNo = material.partnerNo;
          self.addForm.partnerId = material.partnerId;
          self.addForm.sourceDetailId = material.id;
          self.addForm.sourceId = self.sheetHeaderVo.id;
        }
      },
      {
        label: '物料名称',
        prop: 'partName',
        disabled: true
      },
      {
        label: '客户名称',
        prop: 'partnerName',
        disabled: true
      },
      {
        label: '需求数量',
        prop: 'quantity',
        disabled: true
      },
      {
        label: '报检数量',
        prop: 'sendExamineQuantity',
        type: 'number',
        min: 0,
        precision: 0,
        rules: [
          { required: true, message: '报检数量不能为空', trigger: 'blur' }
          // { validator: self.customValidator, trigger: 'blur' }
        ]
      },
      {
        label: '产品型号',
        prop: 'partModel',
        disabled: true
      },
      {
        label: '是否加急',
        prop: 'isUrgent',
        type: 'switch',
        value: false,
        dicData: [
          {
            label: '否',
            value: false
          },
          {
            label: '是',
            value: true
          }
        ]
      },
      // {
      //   label: '检验分类',
      //   prop: 'sourceTypeName',
      //   disabled: true,
      //   value: '出货前'
      // },
      {
        label: '检验说明',
        prop: 'remark'
      }
    ]
  };
};
